package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入秒");
        int in = scanner.nextInt();
        if (in>0) {
            for (int i = in; i >= 0; i--) {
                System.out.println(i+"秒");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("时间到!");
        }else {
            System.out.println("请输入正确的时间");
        }
    }
}
